import axios from 'axios';
const service = axios.create({
  timeout: 10000
});
service.interceptors.request.use(
  config => {
    return config;
  },
  error => {
    console.log(error);
    return Promise.reject();
  }
);
service.interceptors.response.use(
  response => {
    if (response.status === 200) {
      return Promise.resolve(response.data);
    } else {
      Promise.reject(response.data);
    }
  },
  error => {
    if (error.response) {
      switch (error.response.status) {
        case 401:
          setTimeout(() => {}, 2200)
          break;
      }
      return
    }
    return Promise.reject(error);
  }
);
export default service;
